package com.bawei.module_play.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bawei.module_play.databinding.CommonItemBinding
import com.bawei.module_play.entriy.CommendEntity
import com.bawei.module_play.entriy.CommentEntriyItem
import com.example.image.glide.GlideImgLoader

class PlayListAdapter constructor(private val list:MutableList<CommentEntriyItem>):RecyclerView.Adapter<PlayListAdapter.ItemViewHolder>() {


    inner class ItemViewHolder(val dataBinding: CommonItemBinding): RecyclerView.ViewHolder(dataBinding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
        return ItemViewHolder(CommonItemBinding.inflate(LayoutInflater.from(parent.context),parent,false))
    }

    override fun getItemCount(): Int {
        return list.size
    }

    override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
        val entity = list[position]
        holder.dataBinding.commText.text = entity.nickname
        holder.dataBinding.commText2.text = entity.content
        holder.dataBinding.commTime.text = entity.createtime
        GlideImgLoader.loadCircleImage(holder.dataBinding.commImg.context,entity.userlogo,holder.dataBinding.commImg)
    }
}